// src/api/comment.js
import request from '../utils/request'

// 获取所有评论
export const getAllComments = () => {
  return request({
    url: '/api/comment/getAllComments',
    method: 'get'
  })
}

// 获取指定商品的评论
export const getProductComments = (goodsId) => {
  return request({
    url: '/api/comment/getAllComm',
    method: 'get',
    params: { goodsId }
  })
}

// 删除评论
export const deleteComment = (id) => {
  return request({
    url: '/api/comment/delComment',
    method: 'post',
    data: { id }
  })
}

// 添加评论
export const addComment = (data) => {
  return request({
    url: '/api/comment/addComment',
    method: 'post',
    data
  })
}